import { getGoodsInfo } from '@/api/index.js'

const state = {
  goodInfo: ''
}

const mutations = {
  setGoodInfo(state, payLoad) {
    state.goodInfo = payLoad
  }
}

const actions = {
  async getGoodInfo(commit, id) {
    try {
      const res = await getGoodsInfo(id)
      commit('setGoodInfo', res.data)
    } catch (error) {
      return console.dir(error)
    }
  }
}

const getters = {}

export default {
  state,
  mutations,
  actions,
  getters,
  namespaced: true
}
